﻿namespace xrwang.DDNS
{
    /// <summary>
    /// 域名记录操作接口
    /// </summary>
    public interface IDomainRecordOperator
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="record">域名记录</param>
        /// <returns>返回结果。如果成功，Data1为请求id，Data2为记录id。</returns>
        Task<ActionResult<string, string>> AddAsync(DomainRecordInfo record);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="recordId">记录id</param>
        /// <param name="domainName">域名名称</param>
        /// <returns>返回结果。如果成功，Data为请求id。</returns>
        Task<ActionResult<string>> DeleteAsync(string recordId, string domainName = "");

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="record">域名记录</param>
        /// <returns>返回结果。如果成功，Data1为请求id，Data2为记录id。</returns>
        Task<ActionResult<string, string>> UpdateAsync(DomainRecordInfo record);

        /// <summary>
        /// 设置状态
        /// </summary>
        /// <param name="recordId">记录id</param>
        /// <param name="domainName">域名名称</param>
        /// <returns>返回结果。如果成功，Data为请求id。</returns>
        Task<ActionResult<string>> SetStatusAsync(string recordId, string domainName = "", bool enabled = true);

        /// <summary>
        /// 获取域名记录列表
        /// </summary>
        /// <param name="domainName">域名名称</param>
        /// <param name="rr">主机记录</param>
        /// <param name="type">记录类型</param>
        /// <param name="value">记录值</param>
        /// <param name="line">解析线路</param>
        /// <param name="page">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <returns>返回结果。如果成功，Data1为域名记录信息列表，Data2为记录总数。</returns>
        Task<ActionResult<List<DomainRecordInfo>, int>> GetListAsync(string domainName, string rr = "", DomainRecordTypeEnum? type = null, string value = "", string line = "",
            int page = 1, int pageSize = 100);

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="record">域名记录</param>
        /// <returns>返回结果。如果成功，Data1为请求id，Data2为记录id。</returns>
        Task<ActionResult<string, string>> SaveAsync(DomainRecordInfo record);
    }
}